Frontend Forever App
We have a mobile app for you to download and use. And you can unlock many features in the app.
Get it now
Intall Later
Run
HTML
CSS
Javascript
Output
Document
@charset "UTF-8"; @import url(https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800); *, :after, :before { box-sizing: border-box; padding: 0; margin: 0; }
console.log("Event Fired") var path = document.getElementById("subject"); function getNormal(p,normalCalcDist){ var DPath=""; var toCheckAt = path.getTotalLength()*p; var midpoint = path.getPointAtLength(toCheckAt); var pVec = new Vec2(midpoint.x,midpoint.y); var circle = document.querySelector("circle"); DPath+="M"+midpoint.x+" "+midpoint.y; var sigmaL = path.getPointAtLength(normalCalcDist+toCheckAt) sigmaL = new Vec2(sigmaL.x,sigmaL.y); var normal = sigmaL.sub(pVec).rotate(Math.PI/2).normalised(20); DPath+="l"+normal.x+" "+normal.y; circle.setAttribute("cx",pVec.x); circle.setAttribute("cy",pVec.y); return DPath; } function loop(i,completeCondition,todo){ if(completeCondition(i)){return;} try{ i=todo(i) }catch(ex){ console.error(ex); return; } requestAnimationFrame(()=>{ loop(i,completeCondition,todo) }) } loop(0, i=>i>1 ,i=>{ var DPath =""; for(var k=0;k<20;k++){ if(i>=1){break;} DPath+=" "+getNormal(i,1); i+=1/1000; } document.getElementById("normals").setAttribute("d",document.getElementById("normals").getAttribute("d")+DPath); return i; })